package com.business.java2cache.core;

import com.business.java2cache.util.ProReader;

/**
 * 统一用常量获取
 */
public class CacheConstans {
    //配置文件名字
    public final static String CONFIG_FILE = "java2cache";//可以不带.properties

    public final static String ehcache = "ehcache";

    public final static String redis = "redis";

    public final static String memcache = "memcache";

    //读取配置文件
    public static ProReader java2CacheConfig = ProReader.getInstance(CONFIG_FILE);

    //默认存储时间
    public static int defaultTime = Integer.valueOf(java2CacheConfig.getProperty("cache.defaultTime"));
    //memcache,redis时前缀加namespace,多个小项目可以公用redis,不至于混乱
    public static String namespace = java2CacheConfig.getProperty("cache.namespace");
    //ehcache存放时默认的region
    public final static String ehcache_defaultRegion = java2CacheConfig.getProperty("cache.ehcacheregion");
    //redischannel消息订阅默认频道
    public final static String redischannel = "default";
    //空的RGION
    public static String NUllRegion = null;

    public static String cache_broadcast;

    static {
        cache_broadcast = java2CacheConfig.getProperty("cache.L2.provider");
        if (cache_broadcast == null || cache_broadcast.isEmpty() || cache_broadcast.equalsIgnoreCase("none"))
            cache_broadcast = java2CacheConfig.getProperty("cache.L1.provider");
    }


}
